# Copyright 2021 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(default_visibility = ["//visibility:public"])

py_library(
    name = "auth",
    srcs = ["_auth.py"],
)

py_library(
    name = "compression",
    srcs = ["_compression.py"],
)

py_library(
    name = "channel",
    srcs = ["_channel.py"],
    deps = [
        ":common",
        ":compression",
        ":grpcio_metadata",
    ],
)

py_library(
    name = "common",
    srcs = ["_common.py"],
)

py_library(
    name = "grpcio_metadata",
    srcs = ["_grpcio_metadata.py"],
)

py_library(
    name = "interceptor",
    srcs = ["_interceptor.py"],
)

py_library(
    name = "plugin_wrapping",
    srcs = ["_plugin_wrapping.py"],
    deps = [
        ":common",
    ],
)

py_library(
    name = "server",
    srcs = ["_server.py"],
    deps = [
        ":common",
        ":compression",
        ":interceptor",
    ],
)

py_library(
    name = "utilities",
    srcs = ["_utilities.py"],
    deps = [
        ":common",
    ],
)

py_library(
    name = "_simple_stubs",
    srcs = ["_simple_stubs.py"],
)

py_library(
    name = "aio",
    srcs = glob(["aio/**/*.py"]),
)

py_library(
    name = "_runtime_protos",
    srcs = ["_runtime_protos.py"],
)

py_library(
    name = "grpcio",
    srcs = ["__init__.py"],
    data = [
        "//:grpc",
    ],
    imports = ["../"],
    deps = [
        ":aio",
        ":utilities",
        ":auth",
        ":plugin_wrapping",
        ":channel",
        ":interceptor",
        ":server",
        ":compression",
        ":_simple_stubs",
        ":_runtime_protos",
        "//src/python/grpcio/grpc/_cython:cygrpc",
        "//src/python/grpcio/grpc/experimental",
        "//src/python/grpcio/grpc/framework",
        "@six//:six",
    ] + select({
        "//conditions:default": ["@enum34//:enum34"],
        "//:python3": [],
    }),
)
